class CarFactory:
    def createCar(self,brand):
        if brand == "奔驰":
            return Benz()
        elif brand == "宝马":
            return BMW()
        elif brand == "比亚迪":
            return BYD()
        else:
            return "未知品牌,不能创建"


class Benz:
    pass

class BMW:
    pass

class BYD:
    pass


f  = CarFactory()
c1 = f.createCar("奔驰")
c2 = f.createCar("宝马")
print(c1)
print(c2)      